package com.bawei.module_mine.model.entity

import android.os.Parcel
import android.os.Parcelable



data class AddressEntity(
    val id: Long,
    val userId: Long,
    val receiverName: String?,
    val receiverPhone: String?,
    val provinceCode: String?,
    val provinceName: String?,
    val cityCode: String?,
    val cityName: String?,
    val districtCode: String?,
    val districtName: String?,
    val streetCode: String?,
    val streetName: String?,
    val address: String?,
    val postCode: String?,
    var isDefault: Int?,
    val status: String?,
    val remark: String?,
    val latitude: String?,
    val longitude: String?,
    val createTime: String?,
    val updateTime: String?
) : Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readLong(),
        parcel.readLong(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readString()
    ) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeLong(id)
        parcel.writeLong(userId)
        parcel.writeString(receiverName)
        parcel.writeString(receiverPhone)
        parcel.writeString(provinceCode)
        parcel.writeString(provinceName)
        parcel.writeString(cityCode)
        parcel.writeString(cityName)
        parcel.writeString(districtCode)
        parcel.writeString(districtName)
        parcel.writeString(streetCode)
        parcel.writeString(streetName)
        parcel.writeString(address)
        parcel.writeString(postCode)
        parcel.writeValue(isDefault)
        parcel.writeString(status)
        parcel.writeString(remark)
        parcel.writeString(latitude)
        parcel.writeString(longitude)
        parcel.writeString(createTime)
        parcel.writeString(updateTime)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<AddressEntity> {
        override fun createFromParcel(parcel: Parcel): AddressEntity {
            return AddressEntity(parcel)
        }

        override fun newArray(size: Int): Array<AddressEntity?> {
            return arrayOfNulls(size)
        }
    }
}